package leetcode.number;

import java.util.HashMap;
import java.util.Map;

public class FindRepeatNumber {

    public int findRepeatNumber(int[] nums) {
        Map<Integer, Integer> map = new HashMap<>();

        for (int num : nums) {
            if (!map.containsKey(num)) {
                map.put(num, num);
            } else {
                return num;
            }
        }

        return 0;
    }

}
